﻿Public Class frm_VaPara

    Public opcao As String
    Public codigo As Integer
    Public Sub New(ByVal op As String)

        ' This call is required by the designer.
        InitializeComponent()

        opcao = op

    End Sub

    Private Sub bBuscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bBuscar.Click
        If (txtCodigo.Text = "") Then
            MessageBox.Show("Preencha com valor para busca!")
        Else
            codigo = Integer.Parse(txtCodigo.Text)
            Me.Close()
        End If
    End Sub
  
    Private Sub bCancelar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bCancelar.Click
        Me.Close()
    End Sub

    Private Sub txtCodigo_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtCodigo.KeyPress
        If Asc(e.KeyChar) = 3 Or Asc(e.KeyChar) = 8 Or Asc(e.KeyChar) = 22 Or Asc(e.KeyChar) = 24 Then
            Exit Sub
        End If
        If Not Char.IsNumber(e.KeyChar) Then
            e.Handled = True
        End If
    End Sub
End Class